<?php 
class TopSellerAction extends Action{
	public function taobao(){
		$url = file_get_contents('http://s.taobao.com/search?spm=a230r.1.8.13.XemOwH&q=iphone5++%CA%D6%BB%FA%BF%C7&initiative_id=tbindexz_20130203&commend=all&source=suggest&ssid=s5-e-p1&suggest=0_7&newpre=null&atype=b&filterFineness=2&bcoffset=1&sort=sale-desc#rankbar');
	    $url = iconv("GBK", "UTF-8", $url);
		$preg ='#<h3 class="summary"><a stat="(.*)"   href="(.*)" target="_blank" class="EventCanSelect" title="(.*)">(.*)</h3><div class="photo ">(.*)<img data-ks-lazyload="(.*)"    alt=""/>(.*)<em>(.*)</em>#iUs';
	    preg_match_all($preg, $url, $data);
	    //$data[2] 产品链接
	    //$data[3] 产品标题
	    //$data[6] 产品图片
	    //$data[8] 产品价格
	    //$result = array();
	    //$result['link'] = $data[2];
	    //$result['title'] = $data[3];
	    //$result['picture'] = $data[6];
	    //$result['price'] = $data[8];
	    //print_r($result);
	    foreach ($data[2] as $id=>$v){
	    	echo "<li><a href=\"$v\"><img src='".$data[6][$id]."' />".$data[3][$id]."</a><span>".$data[8][$id]."</span></li>";
	    }
	}
}
?>